﻿using Game.Assets.Scripts.Manager;
using Game.Assets.Scripts.Model;
using Game.CheseBoard;
using Game.CheseBoard.Data;
using Game.System.CheseBoard;
using QFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Game.UI
{
    public partial class UICheeseBoardPanel
    {
        bool isShow;
        //测试代码，放入一个道具
        EventSystem eventSystem;
        private void OnGUI()
        {
            if (!isShow && GUI.Button(new Rect(0, 0, 300, 150), "<size=40>Debug</size>"))
            {
                isShow = true;
                eventSystem = EventSystem.current;
                eventSystem.gameObject.SetActive(false);
            }
            if (!isShow)
            {
                return;
            }



            GUI.Box(new Rect(Vector2.zero, new Vector2(Screen.width, Screen.height)), "");
            int w = 300, h = 150;
            int i = 0, x = 0, y = 0;
            void UpdatePos()
            {
                i++;
                x = i % 3;
                y = (i / 3);
            }

            if (GUI.Button(new Rect(x * w + x * 10, 0 * h, w, h), "<size=40>关闭</size>"))
            {
                isShow = false;
                eventSystem.gameObject.SetActive(true);
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=40>添加背包棋子</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9928 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=30>添加配方型生成器</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 1009 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=30>添加1级升级卡</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9916 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=30>添加1级金币</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9919 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=30>添加1级钻石</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9922 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=30>添加1级体力</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9925 });
            }
            UpdatePos();
            if (GUI.Button(new Rect(x * w + x * 10, y * h, w, h), "<size=50>添加地图棋子</size>"))
            {
                TypeEventSystem.Global.Send(new BuyCommodityEvent() { pieceID = 9929 });
            }
            UpdatePos();
        }
    }
}
